import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/session/login',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: '/vue-admin-template/user/info',
    method: 'get',
    params: { token }
  })
}

export function logout() {
  return request({
    url: '/vue-admin-template/user/logout',
    method: 'post'
  })
}

export function getUsers() {
  return request({
    url: '/session/find',
    method: 'get',
  })
}

export function updateUser(user_id,user_name,password,nickname,role,phone,address) {
  return request({
    url: '/session/update',
    method: 'post',
    data:{
      user_id,user_name,password,nickname,role,phone,address
    }
  })
}

export function deleteUser(user_id) {
  return request({
    url: '/session/delete',
    method: 'delete',
    data:{
      user_id,
    }
  })
}